#include "searchuserresponsemessage.h"


SearchUserResponseMessage::SearchUserResponseMessage(const Status& status, const Reason& reason, const UserId& userId, const Nickname& nickname)
{
    m_messageType = MessageType::SearchUserResponse;
    m_status = status;
    m_reason = reason;
    m_userId = userId;
    m_nickname = nickname;
}

SearchUserResponseMessage::SearchUserResponseMessage(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_status = jsonObj[JsonKey::STATUS].toString();
    m_reason = jsonObj[JsonKey::REASON].toString();
    m_userId = jsonObj[JsonKey::USER_ID].toString();
    m_nickname = jsonObj[JsonKey::NICKNAME].toString();
}

QJsonObject SearchUserResponseMessage::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::STATUS] = m_status;
    jsonObj[JsonKey::REASON] = m_reason;
    jsonObj[JsonKey::USER_ID] = m_userId;
    jsonObj[JsonKey::NICKNAME] = m_nickname;
    return jsonObj;
}

Status SearchUserResponseMessage::getStatus() const
{
    return m_status;
}

Reason SearchUserResponseMessage::getReason() const
{
    return m_reason;
}

UserId SearchUserResponseMessage::getUserId() const
{
    return m_userId;
}

Nickname SearchUserResponseMessage::getNickname() const
{
    return m_nickname;
}
